<?php
@session_start();
require_once("connect_db.php");

$sqlGen="SELECT cost_id FROM costlearn ORDER BY cost_id DESC LIMIT 1";
$queryGen=mysql_query($sqlGen,$conn);
$resultGen=mysql_fetch_array($queryGen);
$number =(int)substr($resultGen["cost_id"],2);
$id="co".str_pad(($number+1),6,"0",STR_PAD_LEFT );

$sqlOrder="insert into costlearn (cost_id,cost_No,cost_Name,cost_per,cost_unit,cost_date,cost_time,teach_id) values('".$id."','".$_GET["No"]."','".$_GET["name"]."','".$_GET["per"]."','".$_GET["unit"]."','".$_GET["date"]."','".$_GET["time"]."','".$_SESSION["id"]."') ";
$queryOrder=mysql_query($sqlOrder);

?>